            /* Function for AddImages.php */
            function load_image(id,ext){
             
                 if(validateImageExtension(ext) == false){

                      alert("Please only upload .png,.jpg or .gif image");
                      document.getElementById(id).innerHTML = "<p id="+id+"><input type='file' onChange='load_image(this.id,this.value)' id="+id+" name="+id+"></p>";
                      document.getElementById(id).focus();
                      return;
                  }
             }//end of load_image

             /* Function for AddGlossaryItem.php */
            function load_glossaryImage(id,ext){
             
                 if(validateImageExtension(ext) == false){

                      alert("Please only upload .png,.jpg or .gif image");
                      //document.getElementById(id).innerHTML = "<input type='file' onChange='load_glossaryImage(this.id,this.value)' id="+id+" name="+id+" size='45'>";
                      document.getElementById(id).setAttribute('type', 'input');
                      document.getElementById(id).setAttribute('type', 'file');
                      document.getElementById(id).setAttribute('onChange', 'load_glossaryImage(this.id,this.value)');
                      document.getElementById(id).setAttribute('name', id);
                      document.getElementById(id).setAttribute('size', '45');
                      document.getElementById(id).focus();
                      return;           }
             }//end of load_image

            function validateImageExtension(v)
            {
                 var allowedExtensions = new Array("png","PNG","jpg","JPG","jpeg","JPEG","gif","GIF");
                 for(var ct=0;ct < allowedExtensions.length;ct++)
                 {
                  sample = v.lastIndexOf(allowedExtensions[ct]);
                  if(sample != -1){return true;}
                  }
                 return false;
             }//end of validateExtension
        